Calculate a relative date

Calculate a relative date

There are functions that you can use in your rules to calculate a date relative to another date. You can use both constants and variables for both date and number inputs in these rules.

What do you want to do?

Get the date of the next or previous specified day

Add or subtract a specified number of days to an input date

Add or subtract a specified number of weeks to an input date

Add or subtract a specified number of months to an input date

Add or subtract a specified number of years to an input date

Get the date of the next or previous specified day

To get the date of the next or previous specified day (eg Monday, Tuesday etc) following an input date, you use the Next/Previous Day of the Week function. For example,

the first Thursday of October = the next Thursday on or after 2009-10-01

the last Monday of April = the Monday on or before 2009-04-30

Add or subtract a specified number of days to an input date

To add or subtract a specified number of days to an input date to get a new date, you use the Add Days function. For example,

the settlement date for the property = the date 42 days after 2009-04-17

the date of the auction listing = the date 9 days before the auction completion date

Add or subtract a specified number of weeks to an input date

To add or subtract a specified number of weeks to an input date to get a new date, you use the Add Weeks function. For example,

the end date of the exclusion period = the date 2 weeks after the date of contraction

the date the books were borrowed = the date 3 weeks before the due date of the books

Add or subtract a specified number of months to an input date

To add or subtract a specified number of months to an input date to get a new date, you use the Add Months function. For example,

the waiting period end date = the date 6 months after 2008-10-16

the date the wedding invitations should be sent by = the date 2 months before the wedding date

Add or subtract a specified number of years to an input date

To add or subtract a specified number of years to an input date to get a new date, you use the Add Years function. For example,

the warranty expiry date = the date 5 years after the date of purchase

the date the application was lodged = the date 2 years before 2006-12-23

 

See also: